package unit_5;
import java.util.Scanner;
public class Demo04 {
    public static void reverse(int[] array){
        for(int i = 0; i < array.length / 2; i++){
            int temp;
            temp = array[i];
            array[i] = array[array.length - 1 - i];
            array[array.length - 1 - i] = temp;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[10];
        System.out.print("原数组为：");
        for(int i = 0; i < 10; i++){
            a[i] = sc.nextInt();
            System.out.print(a[i] + " ");
        }
        reverse(a);
        System.out.print("互换后数组为：");
        for(int i = 0; i < 10; i++){
            System.out.print(a[i] + " ");
        }
    }
}
